package com.gxsf.wechatbook.repo;

import com.gxsf.wechatbook.pojo.CheckList;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.util.List;

/**
 * @author BeijiRonin
 * @version 1.0.0
 * @date 2021/1/18 18:04
 */
public interface CheckListRepository extends JpaRepository<CheckList, Long> {
    List<CheckList> findAllByUserIdOrderByCreateTimeDesc(long userId);
    @Transactional
    @Modifying(
            clearAutomatically = true
    )
    @Query("from CheckList c where c.createTime>=:time")
    List<CheckList> findAllByNowDay(Timestamp time);
}